package com.fang.mmy.items.config;

import feign.RequestInterceptor;
import feign.RequestTemplate;

import java.util.UUID;

/**
 * @ClassName CustomFeignInterceptor
 * @Author kebukeyi
 * @Date 2022/8/7 22:20
 * @Description
 * @Version 1.0.0
 */
public class CustomFeignInterceptor implements RequestInterceptor {

    @Override
    public void apply(RequestTemplate requestTemplate) {
        //写一些自己的业务逻辑 带上token 什么之类的
        System.out.println("执行openFeign自定义拦截器");
        String access_token = UUID.randomUUID().toString();
        requestTemplate.header("Authorization", access_token);//设置认证
    }
}
